<?php echo BAIDUMAP_API_KEY; ?>
<script type="text/javascript" src="<?php echo RESOURCE_PATH;?>/js/jquery.validation.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATES_PATH?>/css/brand.css?v=<?php echo VERSION;?>" />
<script type="text/javascript" src="<?php echo TEMPLATES_PATH;?>/js/area_array.js" charset="utf-8"></script>
<script type="text/javascript" src="<?php echo TEMPLATES_PATH;?>/js/common_select.js?v=<?php echo VERSION;?>" charset="utf-8"></script>
<script type="text/javascript" src="<?php echo RESOURCE_PATH?>/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_PATH?>/fancybox/jquery.fancybox-1.3.4.css" media="screen" />

<header class="layout head padding-small">
    <a href="javascript:back(true);" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">品牌详情</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>

<div class="layout">
    <img src="<?php echo SiteUrl.DS.ATTACH_BRAND.DS.$output['brand_store_info']['brand_store_id'].DS.$output['brand_info']['brand_detail_banner']; ?>" alt="" class="layout">
</div>

<div class="brandStore-news margin-bottom">
     <span class="x3 storeLogo text-center">
        <img src="<?php echo SiteUrl.DS.ATTACH_BRAND.DS.$output['brand_store_info']['brand_store_id'].DS.$output['brand_info']['brand_pic']; ?>" alt="" class="radius-big">     </span>
    <div class="x9">
        <p><strong>品牌：<?php echo $output['brand_info']['brand_name']; ?></strong></p>
        <a href="javascript:;" class="x4 collect height"><i class="icon-heart text-big text-d60079 <?php echo $output['is_fal']?'':'icon-heart-o';?> margin-small-right"></i>收藏</a>
        <a href="javascript:;" class="x4  dialogs height" onclick="shareSystem(<?php echo $_SESSION['member_id']?$_SESSION['member_id']:0;?>,'<?php echo $GLOBALS['share_msg'];?>','<?php echo $GLOBALS['share_link'];?>');"><i class="icon-share-alt text-d60079 margin-small-right"></i>分享</a>
        <!--<a href="<?php /*echo SiteUrl.DS."mobile/index.php?act=show_store&op=index&id=".$output['brand_store_info']['brand_store_id']; */?>" class="x4 height show-store"><i class="margin-small-right"></i>品牌商城</a>-->
    </div>
</div>

<?php
    $albumImg = explode(',',$output['brand_info']['brand_album_image']);
    $priceImg = explode(',',$output['brand_info']['brand_price_image']);
    foreach($albumImg as $item){
        if(!is_file(BasePath.DS.ATTACH_BRAND_ALBUM.DS.$output['brand_info']['brand_store_id'].DS.$item)){
            continue;
        }
        $albumArr[] = SiteUrl.DS.ATTACH_BRAND_ALBUM.DS.$output['brand_info']['brand_store_id'].DS.$item;
    }
    foreach($priceImg as $item){
        if(!is_file(BasePath.DS.ATTACH_BRAND_PRICE.DS.$output['brand_info']['brand_store_id'].DS.$item)){
            continue;
        }
        $priceArr[] = SiteUrl.DS.ATTACH_BRAND_PRICE.DS.$output['brand_info']['brand_store_id'].DS.$item;
    }
?>

<div class="brand-nav bg-white layout">
	<ul class="brand-nav-list">
		<li class="curr" nc-item="ppxq">品牌详情</li>
                  <?php if(is_array($output['brand_goods_list'])&&count($output['brand_goods_list'])>0) { ?>
		<li nc-item="splb">商品列表</li>
                  <?php } ?>
                  <?php if(count($albumArr)>0){ ?>
		<li nc-item="cphc">产品相册</li>
                  <?php } ?>
                  <?php if(count($priceArr)>0){ ?>
		<li nc-item="jgb">价格表</li>
                  <?php } ?>
                  <?php if( $output['brand_info']['brand_join_policy'] != ''){ ?>
                  <li nc-item="jmzc">加盟政策</li>
                  <?php } ?>
                  <?php if( !empty($output['brand_map']) && is_array($output['brand_map']) ){?>
		<li nc-item="qybh">区域保护</li>
                  <?php } ?>
                  <?php if( $output['brand_info']['brand_join_wenda'] != ''){ ?>
		<li nc-item="jmwd">加盟问答</li>
                  <?php } ?>
		<li nc-item="mckb">美财口碑</li>
		<li nc-item="ljwm">了解我们</li>
	</ul>
</div>

<ul class="brand-detail-tab margin-top layout">
	<!--品牌详情-->
        <li class="ppxq" id="ppxq" style="display: block;">
            <?php if(trim($output['brand_info']['promotion_content'])!=''){?>
            <div class="BrandDetail"><?php echo htmlspecialchars_decode($output['brand_info']['promotion_content'])?></div>
            <?php }?>
            <?php if(trim($output['brand_info']['product_content'])!=''){?>
            <div class="BrandDetail"><?php echo htmlspecialchars_decode($output['brand_info']['product_content'])?></div>
            <?php }?>
            <?php if(trim($output['brand_info']['marketing_content'])!=''){?>
            <div class="BrandDetail"><?php echo htmlspecialchars_decode($output['brand_info']['marketing_content'])?></div>
            <?php }?>
            <?php if(trim($output['brand_info']['case_content'])!=''){?>
            <div class="BrandDetail"><?php echo htmlspecialchars_decode($output['brand_info']['case_content'])?></div>
            <?php }?>
            <?php if(trim($output['brand_info']['join_content'])!=''){?>
            <div class="BrandDetail"><?php echo htmlspecialchars_decode($output['brand_info']['join_content'])?></div>
            <?php }?>
            <?php if(trim($output['brand_info']['cooperate_content'])!=''){?>
            <div class="BrandDetail"><?php echo htmlspecialchars_decode($output['brand_info']['cooperate_content'])?></div>
            <?php }?>
            <?php 
                if(!empty($output['brand_body']) && is_array($output['brand_body'])){
                    foreach($output['brand_body'] as $item){
            ?>
            <?php if(trim($item['bb_content'])!=''){?>
            <div class="BrandDetail"><?php echo htmlspecialchars_decode($item['bb_content'])?></div>
            <?php }?>
            <?php }?>
            <?php }?>
        </li>
	<!--商品列表-->
	<li class="layout padding" id="splb">
            <div class="line-small">
                <?php 
                    if(is_array($output['brand_goods_list']) && count($output['brand_goods_list'])>0) {
                        foreach($output['brand_goods_list'] as $item){
                ?>
                <div class="x6 margin-small-top ">
                    <a url="index.php?act=goods&goods_id=<?php echo $item['goods_id']; ?>" onClick="pclicked(this);">
                        <ul class="list-unstyle padding-small radius-big bg-white clearfix ">
                            <li><img class="img-responsive self-motion" src="<?php echo thumb($item,'max');?>" onerror="this.src='<?php echo TEMPLATES_PATH . '/images/default_goods_image.gif'; ?>'"></li>
                            <li class="ycyc"><?php echo $item['goods_name']; ?></li>
                            <li class="zt_color height">
                            <strong>
                                批发价:￥<?php if ($_SESSION['is_login'] == '1') {
                                    echo $item['goods_store_price'];
                                } else {
                                    echo '<a url="index.php?act=login" onClick="pclicked(this);">请登录</a>';
                                } ?>
                            </strong>
                            </li>
                        </ul>
                    </a>
                </div>
                <?php 
                        }
                    }
                ?>
            </div>
	</li>
        <!--产品相册-->
        <li class="cpxc" id="cphc">
            <?php if(count($albumArr)>0){?>
            <div class="banner">
                <div class="carousel">
                    <?php foreach($albumArr as $item){ ?>
                    <div class="item"><img src="<?php echo $item?>" class="img-responsive"></div>
                    <?php }?>
                </div>
            </div>
            <?php }?>
        </li>
	<!--价格表-->
        <li class="jgb" id="jgb">
            <?php if(count($priceArr)>0){?>
            <div class="banner">
                <div class="carousel">
                    <?php foreach($priceArr as $item){ ?>
                    <div class="item"><img src="<?php echo $item?>" class="img-responsive"></div>
                    <?php }?>
                </div>
            </div>
            <?php }?>
        </li>
        <!--加盟政策-->
        <li class="jgb" id="jmzc">
            <?php if( $output['brand_info']['brand_join_policy'] != ''){?>
            <img src="<?php echo SiteUrl.DS.ATTACH_BRAND.DS.$output['brand_info']['brand_store_id'].DS.$output['brand_info']['brand_join_policy']?>" class="img-responsive" />
            <?php } ?>
        </li>
	<!--区域保护-->
        <li id="qybh">
            <?php if( $output['brand_info']['brand_area_baohu'] != ''){?>
            <img src="<?php echo SiteUrl.DS.ATTACH_BRAND.DS.$output['brand_info']['brand_store_id'].DS.$output['brand_info']['brand_area_baohu']?>" class="img-responsive" />
            <?php } ?>
            <?php if( $output['brand_map']['brand_join_desc'] != ''){?>
            <div style="padding:5px 15px;  background-color: #fff;"><?php echo $output['brand_map']['brand_join_desc']; ?></div>
            <?php } ?>
            
            <div id="allmap"></div>
            <div class="brand_alliance">
                <form method="post" id="brand_alliance_form" class="form-inline">
                    <input type="hidden" name="ref_url" value="index.php?<?php echo $_SERVER['QUERY_STRING']; ?>" />
                    <div class="form-group" >
                         <div class="field">
                             <select class="input" name="province_id" id="province_id"></select>
                         </div>
                     </div>
                     <div class="form-group" >
                         <div class="field">
                             <input type="text" name="address" id="address" class="input" value="" placeholder="详细地址" />
                         </div>
                     </div>
                    <div class="form-group" >
                         <div class="field">
                             <input type="text" name="true_name" id="true_name" class="input" value="" placeholder="姓名" />
                         </div>
                     </div>
                    <div class="form-group" >
                         <div class="field">
                             <input type="text" name="mobile" id="mobile" class="input" value="" placeholder="手机号码" />
                         </div>
                     </div>
                    <div class="form-group" >
                         <div class="field">
                             <input type="text" name="store_name" id="store_name" class="input" value="" placeholder="商城名称" />
                         </div>
                     </div>
                    <div class="form-group" >
                         <div class="field">
                             <a url="index.php?act=brand_alliance&op=treaty&s_id=<?php echo $output['brand_map']['s_id'];?>" onClick="pclicked(this);">服务协议</a>
                             <input type="checkbox" name="agreement" id="agreement" value="1" />
                             <label for="agreement">同意</label>
                         </div>
                     </div>
                    <div class="form-group" >
                        <input type="submit" value="加盟" class="button button-small bg-red" id="subForm" />
                        <input type="button" class="button button-small bg-yellow" value="查询" onclick="getAddressPoint();"/>
                     </div>
                    <input type="hidden" id="pca_info" name="pca_info" value="" />
                    <input type="hidden" id="lng" name="lng" value="" />
                    <input type="hidden" id="lat" name="lat" value="" />
                    <input type="hidden" name="brand_id" value="<?php echo $output['brand_map']['brand_id'];?>" />
                    <input type="hidden" name="brand_name" value="<?php echo $output['brand_map']['brand_name'];?>" />
                </form>
            </div>
        </li>
        
	<!--加盟问答-->
        <li class="pbwd" id="jmwd">
            <?php if( $output['brand_info']['brand_join_wenda'] != ''){?>
            <img src="<?php echo SiteUrl.DS.ATTACH_BRAND.DS.$output['brand_info']['brand_store_id'].DS.$output['brand_info']['brand_join_wenda']?>" class="img-responsive" />
            <?php } ?>
        </li>
	<!--美财口碑-->
        <li id="mckb">
            
	    <ul class="gc-con padding-none text-small bg-white padding">
                <?php
                    if(!empty($output['comment_list']) && is_array($output['comment_list'])){
                    foreach($output['comment_list'] as $item){
                ?>
	        <li class="gc-list border border-red-light radius-big padding-small ">
	            <p class="margin-none"><?php echo $item['comment_content']?></p>
                     <?php if(count($item['pic_list']) > 0){ ?>
	            <div class="clearfix kbimg">
                        <?php foreach($item['pic_list'] as $pic){ ?>
                        <span class="padding-small x20">
                            <a  rel="example_group_<?php echo $pic['comment_id']; ?>" href="<?php echo SiteUrl.DS.$pic['img_path']; ?>" />
                                <img src="<?php echo SiteUrl.DS.$pic['thumb_img_path']; ?>"/>
                            </a>
                        </span>
                        <script type="text/javascript"> 
                            $("a[rel=example_group_<?php echo $pic['comment_id']; ?>]").fancybox(); 
                        </script>
                        <?php } ?>  
	            </div>
                    <?php } ?>  
	            <div class="list-text height">
                        <span class="date"><?php echo date('Y-m-d H:i:s',$item['comment_addtime'])?></span>
                            <?php echo $item['comment_membername']?>
                     </div>
	        </li>
                <?php } } ?>
	    </ul>
            
	    <dl class="bg-white">
                <form action="index.php?act=brand&op=comment" method="post" class="form-inline" enctype="multipart/form-data">
                    <input type="hidden" name="brand_id" value="<?php echo $output['brand_info']['brand_id']?>" />
                    <input type="hidden" name="brand_store_id" value="<?php echo $output['brand_info']['brand_store_id']?>" />
                    <input name="nchash" id="nchash" type="hidden" value="<?php echo $output['nchash'];?>" />
                    
	    	<dt class="bg-ef7f7e text-white text-center height-big">我要评论</dt>
	    	<dd class="padding">
                    <div class="form-group" >
                        <div class="field">
                            <textarea type="text" class="input" name="comment" data-validate="required:请输入评论内容" placeholder="请输入评论内容" ></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="label text-small">图片上传（支持JPG、PNG、GIF，最多上传 5 张图片）</div>
                        <button type="button" class="button" onclick="addFileUpload()">增加</button> 
                        <div class="field" id="comment_pic">
                            <a class="button input-file" href="javascript:void(0);">
                                + 请选择上传图片
                                <input size="100" type="file" name="comment_pic_1">
                            </a>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field">
                            <div class="button-group">
                                <input type="text" class="input float-left" name="captcha" placeholder="请输入验证码" data-validate="required:请输入验证码" style="width: 65%;"  maxlength="4">
                                <a href="javascript:void(0)" onclick="javascript:document.getElementById('codeimage').src='index.php?act=seccode&op=makecode&nchash=<?php echo $output['nchash'];?>&t=' + Math.random();"><img src="index.php?act=seccode&op=makecode&nchash=<?php echo $output['nchash'];?>" name="codeimage" border="0" id="codeimage" style=" margin-left: 5px; display:inline-block; width: 30%; height: 34px;"></a>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <input type="submit" value="提交评论" class="button button-small bg-red" />
                        <input type="reset" value="重置" class="button button-small bg-yellow" />
                    </div>
	    	</dd>
            </form>
	</dl>
            
	</li>
	<!--了解我们-->
         <li class="ljwm" id="ljwm">
            <?php if( $output['brand_info']['brand_about_women'] != ''){?>
            <img src="<?php echo SiteUrl.DS.ATTACH_BRAND.DS.$output['brand_info']['brand_store_id'].DS.$output['brand_info']['brand_about_women']?>" class="img-responsive" />
            <?php } ?>
            <dl class="margin-top bg-white">
                <dt class="bg-ef7f7e text-white text-center height-big">给我留言</dt>
                <dd class="padding">
                    <form class="form-x" method="post" id="brand_feedback">
                        <input type="hidden" name="brand_store_id" value="<?php echo $output['brand_info']['brand_store_id'];?>" />
                        <input type="hidden" name="brand_id" value="<?php echo $output['brand_info']['brand_id'];?>" />
                        <div class="form-group">
                            <div class="field">
                                <input type="text" class="input" name="feedback_name" maxlength="50" value="" placeholder="请输入您的姓名">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field">
                                <input type="text" class="input" name="feedback_phone" maxlength="11" value="" placeholder="请输入手机号码">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field">
                                <input type="text" class="input" name="feedback_qq" maxlength="11" value="" placeholder="请输入QQ号码">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field">
                                <textarea type="text" class="input" name="feedback_address" maxlength="500" value="" placeholder="请输入地址" ></textarea>
                            </div>
                        </div>
                        <div class="form-group" >
                            <div class="field">
                                <textarea type="text" class="input" name="feedback_content" maxlength="500" value="" placeholder="请输入留言内容" ></textarea>
                            </div>
                        </div>
                        <div class="form-group" >
                            <div class="field">
                                <input type="submit" value="提交留言" class="button button-small bg-red" />
                                <input type="reset" value="重置" class="button button-small bg-yellow" />
                            </div>
                        </div>
                    </form>
                </dd>
            </dl>
        </li>
</ul>

<script type="text/javascript">
	/*$(function(){
		//点击收藏
		$('.collect').on('click',function(){
			$(this).find('.icon-heart').toggleClass('icon-heart-o');
		})
	});*/
    
    var file_item = 2;
    function addFileUpload(){
        if(file_item <= 5){
            $('#comment_pic').append('<a class="button input-file" href="javascript:void(0);">+ 请选择上传图片<input size="100" type="file" name="comment_pic_'+file_item+'"></a>');
            file_item++;
        }
    }
	
    $(function(){
    	//品牌导航长度
    	var bnavList = $('.brand-nav-list li'),
    	 	navLenght= bnavList.length*90;
    	$('.brand-nav-list').width(navLenght);
    	if(navLenght>$('.brand-nav').width()){$('.brand-nav').height(47)}
    	//点击切换
    	bnavList.click(function(){
//    		var listIndex = $(this).index();
//    		$('.brand-detail-tab > li').eq(listIndex).show().siblings().hide();
                var item = $(this).attr('nc-item');
                $('#'+item).show().siblings().hide();
                $(this).addClass('curr').siblings().removeClass('curr');
    	})
    	//点击收藏
        $('.collect').click(function(){
            var favObject = $(this);
            $.get('index.php?act=member_favorites&op=favoritesbrand',{fid:<?php echo $output['brand_id'];?>},function(res){
                if(res.msg){
                    if(res.done == true){
                        favObject.find('.icon-heart').removeClass('icon-heart-o');
                    }
                    alert(res.msg);
                }
            },'json');
        });
    });
    
    ;(function($){
         //轮播宽度问题
        $('.banner').width($(window).width());
        //设置地图区域高度、宽度
        $('#allmap').width($(window).width())
        $('#allmap').height($(window).width());
    })(jQuery)

</script>

<script type="text/javascript">
	var DISTANCE = <?php echo $output['brand_map']['distance'];?>;
	var can = false;
	
	// 百度地图API功能
	var map = new BMap.Map("allmap");
	var point = new BMap.Point(116.331398,39.897445);	 //默认定位城市为北京
	map.centerAndZoom(point,12);
	//打开时先根据IP定位城市
	function myFun(result){
		var cityName = result.name;
		map.setCenter(cityName);
	}
	var myCity = new BMap.LocalCity();
	myCity.get(myFun);
	
	//获取输入地址的坐标
	function getAddressPoint(){
		map.clearOverlays();
		map.closeInfoWindow();
		var myGeo = new BMap.Geocoder();
		var searchTxt = $('#province_id option:selected').text()+$('#city_id option:selected').text()+$('#area_id option:selected').text()+$('#address').val(); 
		$('#pca_info').val($('#province_id option:selected').text()+$('#city_id option:selected').text()+$('#area_id option:selected').text());
		myGeo.getPoint(searchTxt, function (point) {
			if (point) {
				//重新定位
				map.centerAndZoom(point,14);
				var marker = new BMap.Marker(point);
				map.addOverlay(marker);
				//绘制圆形区域
				var circle = new BMap.Circle(point,DISTANCE,{fillColor:"blue", strokeWeight: 1 ,fillOpacity: 0.2, strokeOpacity: 0.2});
				map.addOverlay(circle);
				//标记信息
				var info = "<p style=\'margin:0;line-height:1.5;font-size:13px;text-indent:2em\'>"+searchTxt+"</p>";
				var infoWindow = new BMap.InfoWindow(info);
				map.openInfoWindow(infoWindow,point);
				marker.addEventListener("click", function(){
					map.openInfoWindow(infoWindow,point);
				});
				//查询附近已加盟的数据
				$.getJSON('index.php?act=brand_alliance&op=get_points',{brand_id:$('input[name=brand_id]').val(),mobile:$('input[name=mobile]').val(),brand_name:'<?php echo $output['brand_map']['brand_name'];?>',lng:point.lng,lat:point.lat,distance:DISTANCE},function(res){
					if(res.state){
						for(var i in res.list){
							var pointB = new BMap.Point(res.list[i].lng,res.list[i].lat);
							var marker = new BMap.Marker(pointB);
							map.addOverlay(marker);
							//标记信息
							var info = "<h4 style=\'margin:0 0 5px 0;padding:10px 0 0 0\'>"+res.list[i].store_name+"</h4><p style=\'margin:0;line-height:1.5;font-size:13px;text-indent:2em\'>"+res.list[i].pca_info+res.list[i].address+"</p>";
							var infoWindow = new BMap.InfoWindow(info);
							map.openInfoWindow(infoWindow,pointB);
						}
						can = false;
						alert('对不起，该品牌在本区域已有加盟店，您可以看看其他的热门品牌。');
                                                     pclicked('index.php?act=brand');
					}else{
						can = true;
						$('#subForm').show();
						alert('恭喜！当前地区可以加盟该品牌，您已屏蔽 '+res.num+' 家店家。');
					}
				});
				$('#lng').val(point.lng);
				$('#lat').val(point.lat);
			}else{
				alert('定位失败');
			}
		});
	}
	
$(function(){

    // 手机号码验证   
    jQuery.validator.addMethod("isMobile", function(value, element) {   
        var tel = /^1[3|5|7|8]\d{9}$/;
        return this.optional(element) || (tel.test(value));
    }, "手机号码输入错误");
    //姓名验证
    jQuery.validator.addMethod("isName", function(value, element) {
        return this.optional(element) || /^[\u4E00-\u9FA5]{2,15}$/.test(value);
    });
    $('#brand_alliance_form').validate({
        rules : {
            province_id:{
                required:true
            },
            city_id:{
                required:true
            },
            area_id:{
                required:true
            },
          address:{
                required:true
            },
          true_name:{
                required:true,
              isName : true
            },
          mobile:{
                required:true,
              isMobile : true
            },
          store_name:{
                required:true
            },
        agreement:{
            required:true
        },
    },
        messages : {
            province_id:{
                required:'请选择省份'
            },
            city_id:{
                required:'请选择城市'
            },
            area_id:{
                required:'请选择地区'
            },
          address:{
                required:'请填写详细地址'
            },
           true_name:{
                required:'请填写姓名',
              isName : '姓名输入错误'
            },
          mobile:{
                required:'请填写手机号码',
              isMobile : '手机号码输入错误'
            },
          store_name:{
                required:'请填写店名'
            },
            agreement:{
                required:'请同意服务协议'
            },
        },
        submitHandler: function(form){
            $.post("<?php echo SiteUrl;?>/app/index.php?act=brand_alliance&op=alliance_add",$("form#brand_alliance_form").serialize(),function(data){
                Jump(data);
            },'json');
        }
    });
    
    $('#brand_feedback').validate({
        rules : {
            feedback_name:{
                required:true,
                 isName : true
            },
            feedback_phone:{
                required:true,
                isMobile : true
            },
            feedback_qq:{
                required:true
            },
          feedback_address:{
                required:true
            },
          feedback_content:{
                required:true
            }
        },
        messages : {
            feedback_name:{
                required:'请输入您的姓名',
                 isName : '姓名输入错误'
            },
            feedback_phone:{
                required:'请输入手机号码',
                isMobile : '手机号码输入错误'
            },
            feedback_qq:{
                required:'请输入QQ号码'
            },
          feedback_address:{
                required:'请输入地址'
            },
          feedback_content:{
                required:'请输入留言内容'
            }
        },
        submitHandler: function(form){
            $.post("<?php echo SiteUrl;?>/app/index.php?act=brand&op=feedback",$("form#brand_feedback").serialize(),function(data){
                Jump(data);
            },'json');
        }
    });

    var area_select = $("#province_id");
    areaInit(area_select,0);//初始化地区
    // 选择地区
    $("#province_id").change(provinceChange);
    function provinceChange(){
        can = false;
        $('#subForm').hide();
       // 删除后面的select
       $(this).nextAll("select").remove();
       if (this.value > 0){
            var text = $(this).get(0).options[$(this).get(0).selectedIndex].text;
            var area_id = this.value;
            var EP = new Array();
            EP[1]= true;EP[2]= true;EP[9]= true;EP[22]= true;EP[34]= true;EP[35]= true;
            if(typeof(nc_a[area_id]) != 'undefined'){//数组存在
                var areas = new Array();
                var option = "";
                areas = nc_a[area_id];
            $("<select class='input' name='city_id'  id='city_id'>"+option+"</select>").insertAfter(this);
            $(this).next("select").append("<option value=''>-请选择-</option>");
                for (i = 0; i <areas.length; i++){
                    $(this).next("select").append("<option value='" + areas[i][0] + "'>" + areas[i][1] + "</option>");
                }
            }
       }	 	
    }
    
    $('#city_id').live('change', function() {
        can = false;
        $('#subForm').hide();
            // 删除后面的select
            $(this).nextAll("select").remove();
            if (this.value > 0){
                var text = $(this).get(0).options[$(this).get(0).selectedIndex].text;
                var area_id = this.value;
                var EP = new Array();
                EP[1]= true;EP[2]= true;EP[9]= true;EP[22]= true;EP[34]= true;EP[35]= true;
                if(typeof(nc_a[area_id]) != 'undefined'){//数组存在
                    var areas = new Array();
                    var option = "";
                    areas = nc_a[area_id];
                    if (typeof(EP[area_id]) == 'undefined'){
                        option = "<option value=''>-请选择-</option>";
                    }
                    $("<select class='input' name='area_id' id='area_id'>"+option+"</select>").insertAfter(this);
                    for (i = 0; i <areas.length; i++){
                        $(this).next("select").append("<option value='" + areas[i][0] + "'>" + areas[i][1] + "</option>");
                    }
                }
            }
    });
    $('#area_id').live('change',function(){can = false;$('#subForm').hide();});
    $('#address').live('change',function(){can = false;$('#subForm').hide();});
});
</script>